package br.ufrgs.meetapp.enums;

public enum SettingsComponent {
	
	TRACKER_OFF("GPSPowerOff", "istrackeroff"),
	TRACKER_OTHERS_ON("TrackOthersOn", "istrackerotherson"),
	TIME_INTERVAL("BattInterval", "trackertimeinterval"),
	SENDING_INTERVAL("SendingInterval", "sendinginterval"),
	DISTANCE_INTERVAL("DistanceInterval", "trackerdistanceinterval"),
	MOTION_SPEED_THRESHOLD("MotionSpeedThresholdMax", "motionspeedtreshold" ),
	MOTION_STOP_THRESHOLD("MotionStopThreshold", "motionstoptreshold"),	
	COURSE_RANGE("CourseRange", "trackeranglechange"),
	ACQUIRE_TIMEOUT("AquireTimeout", "gpsacquisitiontimeout");
	
	private String serverLabel;
	private String sharedPreferencesLabel;
	
	
	private SettingsComponent (String _serverLabel, String _sharedPreferencesLabel) {
		serverLabel = _serverLabel;
		sharedPreferencesLabel = _sharedPreferencesLabel;
	}
	
	public String getServerLabel() {
		return serverLabel;
	}
	
	public String getSharedPreferencesLabel() {
		return sharedPreferencesLabel;
	}
	
	public SettingsComponent getSettingsComponentByServerLabel(String serverLabel){
		
		if(serverLabel.equals(TRACKER_OFF.getServerLabel())){
			
		}
		
		return SettingsComponent.ACQUIRE_TIMEOUT;
	}
	
	public static SettingsComponent fromServerLabelString(String text) {
	    if (text != null) {
	      for (SettingsComponent b : SettingsComponent.values()) {
	        if (text.equalsIgnoreCase(b.serverLabel)) {
	          return b;
	        }
	      }
	    }
	    return null;
	  }
	
}
